package com.netease.pris.activity;

import android.app.ProgressDialog;
import android.content.Context;
import android.os.AsyncTask;
import android.os.PowerManager;
import android.os.PowerManager.WakeLock;
import com.netease.a.a.e;
import com.netease.g.b;
import com.netease.pris.a.f;
import com.netease.pris.a.h;
import java.io.File;

class cq extends AsyncTask
{
  public static final int a = 0;
  public static final int b = 1;
  public static final int c = 3;
  private Context e;
  private PowerManager.WakeLock f;

  public cq(OfflineDownloadError paramOfflineDownloadError, Context paramContext)
  {
    this.e = paramContext;
    this.f = ((PowerManager)this.e.getSystemService("power")).newWakeLock(1, "CacheClearTask");
  }

  protected Integer a(Void[] paramArrayOfVoid)
  {
    String str1 = e.d();
    String str2 = e.e();
    while (true)
    {
      long l;
      int j;
      File localFile2;
      try
      {
        this.f.acquire();
        com.netease.pris.a.i.f(str2);
        File localFile1 = new File(str1);
        if (localFile1.exists())
          continue;
        com.netease.pris.c.i.b(this.d, null);
        Integer localInteger3 = Integer.valueOf(1);
        localObject2 = localInteger3;
        return localObject2;
        String[] arrayOfString1 = localFile1.list();
        if (arrayOfString1 != null)
          continue;
        int i = 0;
        if (i != 0)
          continue;
        String[] arrayOfString3 = new String[2];
        arrayOfString3[0] = String.valueOf(100);
        arrayOfString3[1] = "0";
        publishProgress(arrayOfString3);
        com.netease.pris.c.i.b(this.d, null);
        Integer localInteger2 = Integer.valueOf(3);
        localObject2 = localInteger2;
        if ((this.f == null) || (!this.f.isHeld()))
          continue;
        this.f.release();
        this.f = null;
        e.b(str1);
        e.b(str2);
        continue;
        i = arrayOfString1.length;
        continue;
        e.a(str1);
        e.a(str2);
        OfflineDownloadError.a(this.d).setMax(i);
        l = 0L;
        j = 0;
        if (j >= i)
          break label503;
        synchronized (OfflineDownloadError.b(this.d))
        {
          if (!OfflineDownloadError.c(this.d))
            continue;
          b.c("doInBackground", "user cancel！");
          OfflineDownloadError.a(this.d, false);
          localObject2 = Integer.valueOf(0);
          if ((this.f == null) || (!this.f.isHeld()))
            continue;
          this.f.release();
          this.f = null;
          e.b(str1);
          e.b(str2);
          continue;
          localFile2 = new File(str1, arrayOfString1[j]);
          boolean bool = localFile2.exists();
          if (!bool)
            j++;
        }
      }
      finally
      {
        if ((this.f == null) || (!this.f.isHeld()))
          continue;
        this.f.release();
        this.f = null;
        e.b(str1);
        e.b(str2);
      }
      if (localFile2.isFile())
        l += localFile2.length();
      while (true)
      {
        e.a(localFile2);
        String str3 = f.a(this.e, l);
        String[] arrayOfString2 = new String[2];
        arrayOfString2[0] = String.valueOf(j + 1);
        arrayOfString2[1] = str3;
        publishProgress(arrayOfString2);
        break;
        if (!localFile2.isDirectory())
          continue;
        l += f.e(localFile2);
      }
      label503: com.netease.pris.c.i.b(this.d, null);
      e.c(str2);
      e.c(str1);
      Integer localInteger1 = Integer.valueOf(1);
      Object localObject2 = localInteger1;
      if ((this.f != null) && (this.f.isHeld()))
      {
        this.f.release();
        this.f = null;
      }
      e.b(str1);
      e.b(str2);
    }
  }

  protected void a(Integer paramInteger)
  {
    if (paramInteger.intValue() == 1)
      h.a(this.e, 2131362323);
    if (paramInteger.intValue() == 0)
      h.a(this.e, 2131362073);
    if (paramInteger.intValue() == 3);
    this.e = null;
    if (OfflineDownloadError.a(this.d) != null)
    {
      OfflineDownloadError.a(this.d).dismiss();
      OfflineDownloadError.a(this.d, null);
    }
    this.d.finish();
  }

  protected void a(String[] paramArrayOfString)
  {
    super.onProgressUpdate(paramArrayOfString);
    int i = Integer.valueOf(paramArrayOfString[0]).intValue();
    OfflineDownloadError.a(this.d).setProgress(i);
    ProgressDialog localProgressDialog = OfflineDownloadError.a(this.d);
    OfflineDownloadError localOfflineDownloadError = this.d;
    Object[] arrayOfObject = new Object[1];
    arrayOfObject[0] = paramArrayOfString[1];
    localProgressDialog.setMessage(localOfflineDownloadError.getString(2131362071, arrayOfObject));
  }

  protected void onPreExecute()
  {
    OfflineDownloadError.a(this.d, new ProgressDialog(this.e));
    OfflineDownloadError.a(this.d).setMax(100);
    OfflineDownloadError.a(this.d).setProgressStyle(1);
    ProgressDialog localProgressDialog = OfflineDownloadError.a(this.d);
    OfflineDownloadError localOfflineDownloadError = this.d;
    Object[] arrayOfObject = new Object[1];
    arrayOfObject[0] = this.d.getString(2131362072);
    localProgressDialog.setMessage(localOfflineDownloadError.getString(2131362071, arrayOfObject));
    OfflineDownloadError.a(this.d).setCancelable(false);
    OfflineDownloadError.a(this.d).setButton(-2, this.d.getString(2131362053), new cl(this));
    OfflineDownloadError.a(this.d).show();
  }
}

/* Location:           D:\android\hack\dex2jar-0.0.9.8\classes_dex2jar.jar
 * Qualified Name:     com.netease.pris.activity.cq
 * JD-Core Version:    0.6.0
 */